#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main() {
    short days[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    int begin, end;
    cin >> begin >> end;
    int count = 0;
    for (int month = 1; month <= 12; ++month) {
        for (int day = 1; day <= days[month]; ++day) {
            int year = (day % 10) * 1000 + (day / 10) * 100 + (month % 10) * 10 + (month / 10);
            int date = year * 10000 + month * 100 + day;
            if (date >= begin && date <= end)count++;
        }
    }
    cout << count;
}